﻿using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace WebApp
{
    public class MyMiddleware
    {
        private RequestDelegate _next;

        public MyMiddleware(RequestDelegate next)
        {
            _next = next;
        }

        public async Task Invoke(HttpContext context, ILogger<MyMiddleware> logger)
        {

            logger.LogDebug($"{nameof(MyMiddleware)} Invoke.");
            await context.Response.WriteAsync("MyMiddleware invoke ..\r\n");
            await _next(context);
        }
    }

}
